'use strict'
import React from 'react'
import style from './css.css'
import { View, Button } from '../../component'

class NoMoney extends React.Component {
  static propTypes = {
    resultState: PropTypes.number,
    history: PropTypes.object,
    changenoMoneyState: PropTypes.func
  }
  _handClose = this._handClose.bind(this)
  _handleToMoney=this._handleToMoney.bind(this)
  _handleToShare=this._handleToShare.bind(this)
  _handleToShare () {
    this.props.history.push('/set/share')
  }
  _handleToMoney () { window.location.href = 'imgotv://coinpay?f=6' }
  _handClose () {
    this.props.changenoMoneyState()
  }
  render () {
    const { resultState } = this.props
    return (
      <View className={ resultState === 0 ? style.hide : style.tomMoneyBox}>
        <View className={ resultState === 0 ? style.moneyBox : style.moneyBoxShow }>
          <View className={ style.moneyMainBox }>
            <View className={ style.moneyMainBoxText }>余额不足，您可以</View>
            <Button tap={this._handleToMoney} tapClassName={ style.moneyMainBoxChargePress } className={ style.moneyMainBoxCharge }>去充值</Button>
            <Button tap={this._handleToShare} tapClassName={style.moneyMainBoxInvetPress} className={ style.moneyMainBoxInvet }>邀请赚币</Button>
          </View>
          <Button tap={this._handClose} tapClassName={style.moneyClosePress } className={ style.moneyClose}></Button>
        </View>
      </View>
    )
  }
}

export default NoMoney
